<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
  <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  <link rel="stylesheet" href="../../css/animate.css">
  <link rel="stylesheet" href="../../iconfont/iconfont.css">
  <link rel="stylesheet" href="../../css/mescroll.css">
  <link rel="stylesheet" href="../../css/gloab.css">
  <title>加粉详情</title>
</head>
<style>
    .connect-modify{
    position:fixed;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    left:0;
    top:0;
    }
    .connect-modify-center{
    width: 90%;
    border-radius: 0.14rem;
    box-sizing: border-box;
    padding: 0.24rem;
    margin: 3rem auto 0;
    background-color: #fff;
    text-align:center;
    position: relative;
    }
    .connect-modify-center-title{
    font-size: 0.3rem;
    margin-top:0.24rem;
    }
    .connect-modify-center-text{
    font-size: 0.28rem;
    margin-top:0.4rem;
    }
    .connect-modify-center img{
    width: 2.95rem;
    margin: 0.3rem auto;
    }
    .connect-modify-center-btn{
    width: 1.42rem;
    height: 0.48rem;
    line-height: 0.48rem;
    text-align:center;
    background-color: #f69246;
    border-radius: 0.08rem;
    color:#fff;
    font-size: 0.28rem;
    margin: 0.3rem auto;
    }
    .connect-modify-center-close{
    position:absolute;
    right:0.24rem;
    top:0;
    }
    .connect-modify-center-close img{
    width: 0.5rem;
    }
</style>
<body>
  <div id="app">
    <div id="public-header">
      <div id="statusbar"></div>
      <header class="public-header">
        <div class="public-header-lf iconfont icon-fanhui" @click="javascript:api.closeWin();"></div>
        <div class="public-header-title">加粉详情</div>
      </header>
    </div>
    <div style="width:100%;">
      <div class="product-category-list">
        <div class="product-category-list-son" style="box-shadow:none;">
          <div class="product-category-list-header flex wrap">
              <div class="product-category-list-header-lf" style="height:1.01rem;">
                <img src="../../image/public/touxiang.png" alt="" v-if="!info.user.avatar">
                <img :src="apiUrl1+info.user.avatar" v-else alt="">
                <label class="product-category-list-header-label">{{info.user.user_type}}</label>
                <!-- <label class="product-category-list-header-label zzlabel">站长</label> -->
              </div>
              <div class="product-category-list-header-rt">
                <div class="product-category-list-header-name flex wrap">
                  <div class="product-category-list-header-name-lf F2">{{info.user.nickname}}</div>
                  <div class="product-category-list-header-name-look F1" @click="look()"><span>查看二维码</span></div>
                  <div class="connect-modify" v-if="erweima">
                    <div class="connect-modify-center">
                      <div class="connect-modify-center-close"><img src="../../image/public/close.png" alt="" @click="close"></div>
                      <div id="save">
                        <img :src="apiUrl1+avatar" alt="">
                      </div>
                      <div class="" style="height:0.45rem;width:100%;margin:auto 0;"><div style="margin:auto;color:#fff;border-radius:0.05rem;line-height:0.45rem;background:#4293f2;width:25%;height:0.45rem;" @click="save(avatar)">保存</div></div>
                      <div class="connect-modify-center-text">注：微信二维码请保存到相册再微信扫码</div>
                    </div>
                  </div>
                </div>
                <div class="product-category-list-header-name flex">
                  <div class="guanggao-details-head-rt flex wrap">
                    <div class="guanggao-details-head-rt-son">曝光次数：<span>{{info.view_count}}</span></div>
                    <div class="guanggao-details-head-rt-son">微信号：<span>{{info.wechat}}</span></div>
                    <div class="guanggao-details-head-rt-son">发布时间：<span>{{info.update_time_str}}</span></div>
                    <div class="guanggao-details-head-rt-son">广告ID：<span>{{info.id}}</span></div>
                  </div>
                </div>
              </div>
          </div>
        </div>
      </div>
      <div class="guanggao-details-content">
       	<div class="guanggao-details-content-text" v-html="info.content"></div>
        <!-- <div class="guanggao-details-ewm" v-if="item.images" v-for="(items,index) in item.images"><img :src="apiUrl+items" alt="" ></div> -->
       <div class="guanggao-details-content-imgs flex wrap" v-if="info.imgs&&info.imgs.length>0">
          <div class="guanggao-details-content-img" v-for="(items,index) in info.imgs">
          	<img @click="seeImg(info,index)" :src="apiUrl1+items" alt="">
          </div>
        </div>
        <p class="auto">注：微信二维码请保存到相册再微信扫码<br>[联系我请备注<span style="color:#ff4747;">趣引流</span>看到的]</p>
      </div>
     <!-- <div class="guanggao-details-page flex">
        <div class="guanggao-details-page-son F1">
          <img src="../../image/personal/guanggao_lf.png" alt="" @click="dec">
          <span>上一个</span>
        </div>
        <div class="guanggao-details-page-son F1">
          <img src="../../image/personal/guanggao_rt.png" alt="" @click="Inc">
          <span>下一个</span>
        </div>
      </div> -->
      <div class="guanggao-details-share flex wrap auto" style="margin-top:0.46rem;">
        <div class="guanggao-details-share-lf F2"></div>
        <div class="guanggao-details-share-text F1">分享至</div>
        <div class="guanggao-details-share-lf F2"></div>
      </div>
      <div class="guanggao-details-page auto" style="text-align:center;margin-top:0.2rem;padding-bottom:0.5rem;font-size:0.2rem;">
        <div class="guanggao-details-page-son" style="display:inline-block;margin-right:0.3rem;color:#404040;" @click="shares">
          <img src="../../image/personal/icon1.png" alt="">
          <span>微信</span>
        </div>
        <div class="guanggao-details-page-son" style="display:inline-block;color:#404040;" @click="share">
          <img src="../../image/personal/icon2.png" alt="">
          <span>朋友圈</span>
        </div>
      </div>
    </div>
  </div>
  <div class="public-progress" style="z-index:9;">
   <img src="../../icon/icon150x150.png" alt="" class="animated infinite flash" style="width:200px;height:200px;display:block;margin:200px auto;">
  </div>
</body>
<script src="../../script/api.js"></script>
<script src="../../script/jquery.js"></script>
<script src="../../script/mescroll.js"></script>
<script src="../../script/vue.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/jsencrypt.js"></script>
<script src="../../script/fastclick.js"></script>

<script>
var vm;
var mescroll;
var mySwiper;
var dialogBox;
apiready=function(){
  api.removeLaunchView();
  setBar("statusbar");
  setFont(750);
  startVue();
  $(".public-progress").fadeOut(1000);
  setTimeout(function(){
    $(".public-progress").css({"display":"none"});
  },1000);
  FNScanner = api.require('FNScanner');
}
function startVue(){
  vm = new Vue({
    el:"#app",
    data:{
      list:["","","","","",""],
      page:0,
      pages:0,
      info:[],
	 avatar:api.pageParam.avatar,
      erweima:false,
      isLong:false,
    },
    created:function(){
      this.jiafen();
    },
    methods:{
      //获取分享赠送积分
      getIntegral:function(){
        api.ajax({
            url: apiUrl+'api/home/getIntegral',
            method: 'post',
            data: {
                values: {
                  uid:post_en($api.getStorage('uid')),
                },
            }
        },function(ret, err){
            if (ret.status) {
              alert(ret.msg);
            } else {
              alert(ret.msg);
            }
        });
      },
      //分享到好友
      shares:function(){
        var wxPlus = api.require('wxPlus');
        wxPlus.isInstalled(function(ret, err) {
            if (ret.installed) {
              var wxPlus = api.require('wxPlus');
              wxPlus.shareWebpage({
                  apiKey: '',
                  scene: 'session',
                  title: '最新项目',
                  description: '本条信息由趣引流平台推送，您也想自动引流，自动推广就下载吧。',
                  thumb: 'widget://icon/logo.jpg',
                  contentUrl:apiUrl+"/index.php/index/index/user/user.html?ids="+JSON.stringify(vm.info[0]['ad_id']),
              }, function(ret, err) {
                  if (ret.status) {
                      vm.getIntegral();
                  } else {
                      alert(err.code);
                  }
              });
            } else {
                alert('当前设备未安装微信客户端');
            }
        });
      },
      //分享朋友圈
      share:function(){
        var wxPlus = api.require('wxPlus');
        wxPlus.isInstalled(function(ret, err) {
            if (ret.installed) {
              var wxPlus = api.require('wxPlus');
              wxPlus.shareWebpage({
                  apiKey: '',
                  scene: 'timeline',
                  title: '最新项目',
                  description: '本条信息由趣引流平台推送，您也想自动引流，自动推广就下载吧。',
                  thumb: 'widget://icon/logo.jpg',
                  contentUrl:apiUrl+"/index.php/index/index/user/user.html?ids="+JSON.stringify(vm.info[0]['ad_id']),
              }, function(ret, err) {
                  if (ret.status) {
                    vm.getIntegral();
                  } else {
                      alert(err.code);
                  }
              });
            } else {
                alert('当前设备未安装微信客户端');
            }
        });
      },
      seeImg:function(item,index){
        var array = [];
        for (var i = 0; i < item.imgs.length; i++) {
          array.push(apiUrl1+item.imgs[i]);
        }
        var photoBrowser = api.require('photoBrowser');
        photoBrowser.open({
            images:array,
            placeholderImg: 'widget://res/img/apicloud.png',
            bgColor: '#000'
        }, function(ret, err) {
			if(ret.eventType == 'longPress'){ save_img(array); }
          if (ret.eventType=='click') {
            var photoBrowser = api.require('photoBrowser');
            photoBrowser.close();
          }
        });
      photoBrowser.setIndex({
          index: index
      });
      },
      dec:function(){//上一个
        if (this.page==0) {
          msg('已经到顶了')
          return;
        }else{
          this.page--;
          api.ajax({
              url: apiUrl+'api/Advertisement/advertisementalls',
              method: 'post',
              data: {
                  values: {
                      id: 'fen',
                      page:this.page,
                      showpage:1,
                  },
              }
          },function(ret, err){
              if (ret.status) {
                vm.info = ret.data;
              }
          });
        }
      },
      Inc:function(){//下一个
        if (this.info=="") {
          return;
        }else{
          this.page++;
          api.ajax({
              url: apiUrl+'api/Advertisement/fenye',
              method: 'post',
              data: {
                  values: {
                      id: 'fen',
                      page:this.page,
                      showpage:1,
                  },
              }
          },function(ret, err){
              if (ret.status) {
                vm.info = ret.data;
              }else {
                api.toast({
                    msg:ret.msg,
                    duration: 2000,
                    location: 'middle'
                });
              }
          });
        }
      },
      jiafen:function(){
        var self = this;
        var uid=api.pageParam['uid'];
        var id=api.pageParam['id'];
        api.ajax({
            url: apiUrl+'/api/index/adDetail',
            method: 'post',
            data: {
                values: {
                    id: id
                },
            }
        },function(ret, err){
            if (ret.code==1) {
              vm.info = ret.data
            } else {
              vm.info = ret.data;
            }
        });
      },
      save:function(index){
        var url = index;
        var result=hasPermission('storage');//权限检测
        var text='"趣引流"需要使用相册功能,请设置本地存储权限,点击确定前往设置本地存储权限,点击取消拒绝';
        requestPermission(text,'storage',result,function(bool){
          if (bool) {
        api.download({
            url: apiUrl1+url,
            savePath: 'fs://Camera/'+new Date().getTime()+'.png',
            report: true,
            cache: true,
            allowResume: true
        }, function(ret, err) {
            if (ret.state == 1) {
              api.saveMediaToAlbum({
                  path: ret.savePath,
                  groupName:'fs://',
              }, function(ret, err) {
                  if (ret && ret.status) {
                      alert('保存成功');
                  } else {
                      alert('保存失败');
                  }
              });
            }
        });
      }else{
        msg("获取本地储存权限失败!无法打开相册");
      }
    })
  },
      look:function(){
        vm.erweima=true;
      },
      close:function(){
        vm.erweima=false;
      },
    }
  })
}
</script>
</html>
